#include "message.h"
#include<QDebug>
Message::Message(QObject *parent) : QObject(parent)
{

}

void Message::setAuthor(const QString &a)
{
    if(a!=m_author)
    {
        m_author=a;
        emit authorChanged();
    }
}

QString Message::author() const
{
    return m_author;
}

bool Message::postMessage(const QString &msg)
{
    qDebug()<<"Called the C++ method with"<<msg;
    return true;
}

void Message::refresh()
{
    QString a=QDateTime::currentDateTime().toString("yyyy/MM/dd");
    qDebug()<<"a is .."<<a;
    QDate nowdate=QDate::fromString(a,"yyyy/MM/dd");
    qDebug()<<"Called the C++ slot";
    qDebug()<<nowdate;
    emit sendresfresh(nowdate);
}

void Message::qmlToCppSlot(QString str)
{
    qDebug()<<tr("我从QML界面获取了信号")<<str;
}

void Message::doSomeThing(MESSAGE_COLOR messageColor)
{
    qDebug()<<"Message::doSomeThing() is"<<messageColor;
}
